GetListPos
CurrentPos = GetListPos(List())
 
Parameters:

    List() = The Type list handle you want to query
Returns:

    CurrentPos = The current position index the list is pointing at
 

      The GetListPos() function retrieves the current position index from the queried linked list.




FACTS:


      * Don't know what a linked list is ?, make sure you read the LinkedLists tutorial then.





Mini Tutorial:


      This example creates a list of three people, then runs through and manually displays each persons name and their list position.

  
; Declare the "Person" user defined type.
  Type Person
   ; These Fields will hold this persons name
     FirstName$
     SurName$
  EndType
  
;  Dimension the Friends variable of type Person,
; with linked list support
  Dim  Friends As Person List
  
  
; Add a person (Billy) to Friends list
  Friends= New Person
  Friends.FirstName$ ="Billy"
  Friends.Surname$ ="Citizen"
  
  
; Add another person (Sally) to Friends list
  Friends= New Person
  Friends.FirstName$      ="Sally"
  Friends.Surname$           ="Stevens"
  
; Add another person (Sally) to Friends list
  Friends= New Person
  Friends.FirstName$      ="Olivia"
  Friends.Surname$           ="Dude"
  
  
  
; Aak the list what cell is at the front/start of the list
  ThisLInk=GetListFirst(Friends())
  
;Enter a while loop providing the link is above 0
  While ThisLink>0
     
   ; Manually Set our Current position in the list
     SetListPos Friends(),ThisLInk
     
   ; Display this persons current position.
     Print "List Position="+Str$(GetListPos(Friends()))
     
   ; Display this persons name
     Print Friends.FirstName$+" "+Friends.Surname$
     Print ""
     
   ; Ask the list for the Next LINK to move forward through
   ; the list.
     ThisLink=GetListNext(Friends())
  EndWhile
  
; display the screen and wait for a key press
  Sync
  WaitKey
  
  




This example would output.

  
  List Position=3
  Olivia Dude
  
  List Position=2
  Sally Stevens
  
  List Position=1
  Billy Citizen
  
  

 
Related Info: GetListFirst | GetListNext | GetListPrevious | GetListSize | LinkedLists | List | SetListPos :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com